package leader.print;

import java.util.List;

import leader.service.DirectTeacherService;
import leader.tool.JTableDefine;
import teacher.bean.Paper;
import teacher.bean.Teacher;
import tools.StringDate;

public class PaperPrint {
	public void printPaper(List<Paper> lists) {
		DirectTeacherService DT = new DirectTeacherService();
		String[][] columnNames = new String[lists.size()+1][7];		
		columnNames[0] = new String[]{"编号","名称","作者","通讯作者","期刊","发表日期","期刊类型"};
		for(int i=1;i<lists.size()+1;i++) {
			Paper paper = lists.get(i-1);
//			System.out.println(paper.getName());
			columnNames[i][0] = String.valueOf(i);
			columnNames[i][1] = paper.getName();
			System.out.println(paper.getName());
			columnNames[i][2] = paper.getFauthor();
			System.out.println(paper.getFauthor());
			System.out.println(paper.getTeaId());
			Teacher tea = new Teacher();
			tea.setTeaId(paper.getTeaId());			
			columnNames[i][3] = DT.selectTeacherById(tea).getName();
			System.out.println(DT.selectTeacherById(tea).getName());
			columnNames[i][4] = paper.getPbulication();
			System.out.println(paper.getPbulication());
			StringDate date = new StringDate();
			columnNames[i][5] = date.DateToString(paper.getDate());
			System.out.println(date.DateToString(paper.getDate()));
			columnNames[i][6] = "待定";
		}
		int[] px = new int[]{40,120,50,50,105,80,80};
		JTableDefine d = new JTableDefine();
		d.printTable(columnNames,px);
		System.out.println("============================");
	}
}
